#! /bin/bash
#####################################################################
################# install for antispam environment ##################
#################                  version  1.0.0  ##################
#################                     liushaohui   ##################
#################             SafeCenter @renren   ##################
#####################################################################
# antispam env 

#当前目录
export AS_DIR=`pwd`
# 配置文件目录
export AS_CONF_DIR=${AS_DIR}/conf
# 脚本目录
export AS_BIN_DIR=${AS_DIR}/bin
# 源文件目录
export AS_SOURCE_DIR=${AS_DIR}/source
# 创建源文件目录
mkdir ${AS_SOURCE_DIR}
# 将需要安装的源文件拷贝到对应的目录
cp ${AS_DIR}/sourcefile/* ${AS_SOURCE_DIR}
# 文件安装目录
export AS_INSTALL_DIR=/data
# 链接的目录
export AS_LINK_DIR=/opt
cd ${AS_DIR}
# 导入配置文件
file="${AS_CONF_DIR}/AS-ENV.sh"
if [ -f "${file}" ]; then
	. "${file}"
else
	echo "no ${file}!"
	exit 0	
fi

# 所有的安装文件已经下载完成
# download install file
#file="${AS_BIN_DIR}/download.sh"
#if [ -f "${file}" ]; then
#	. "${file}"
#else
#	echo "no ${file}"
#	exit 0
#fi

# install java maven ant
file="${AS_BIN_DIR}/install-base.sh"
if [ -f "${file}" ]; then
        . "${file}"
else
        echo "no ${file}"
        exit 0
fi
# install ice ThirdParty
file="${AS_BIN_DIR}/install-Ice-ThirdParty.sh"
if [ -f "${file}" ]; then
        . "${file}"
else
        echo "no ${file}"
        exit 0
fi

# install ice
file="${AS_BIN_DIR}/install-Ice.sh"
if [ -f "${file}" ]; then
        . "${file}"
else
        echo "no ${file}"
        exit 0
fi

# install xiaonei_antispam
file="${AS_BIN_DIR}/install-AS.sh"
if [ -f "${file}" ]; then
        . "${file}"
else
        echo "no ${file}"
        exit 0
fi
rm -rf ${AS_SOURCE_DIR}
